import matplotlib.pyplot as plt

# 数据
methods = ['PSCC-Net', 'BEIT', 'SwinTransformer', 'DocTamper', '本文方法']
doc_tamper_testing_80 = [0.297, 0.407, 0.443, 0.772, 0.803]
doc_tamper_testing_90 = [0.305, 0.451, 0.514, 0.793, 0.836]
doc_tamper_fcd_80 = [0.304, 0.342, 0.337, 0.597, 0.638]
doc_tamper_fcd_90 = [0.317, 0.373, 0.431, 0.604, 0.664]
doc_tamper_scd_80 = [0.273, 0.301, 0.443, 0.526, 0.611]
doc_tamper_scd_90 = [0.331, 0.409, 0.482, 0.599, 0.674]
plt.rcParams["font.sans-serif"]=["SimHei"] #设置字体
# 绘制折线图
plt.figure(figsize=(14, 8))

# DocTamper-TestingSet
plt.plot(methods, doc_tamper_testing_80, marker='s', linestyle='-', label='DocTamper-TestingSet 80')
plt.plot(methods, doc_tamper_testing_90, marker='s', linestyle='-', label='DocTamper-TestingSet 90')

# DocTamper-FCD
plt.plot(methods, doc_tamper_fcd_80, marker='o', linestyle='--', label='DocTamper-FCD 80')
plt.plot(methods, doc_tamper_fcd_90, marker='o', linestyle='--', label='DocTamper-FCD 90')

# DocTamper-SCD
plt.plot(methods, doc_tamper_scd_80, marker='>', linestyle='-.', label='DocTamper-SCD 80')
plt.plot(methods, doc_tamper_scd_90, marker='>', linestyle='-.', label='DocTamper-SCD 90')

# 图例、标题和标签
plt.legend()
plt.title('不同方法在不同压缩比率下的检测交并比')
plt.ylabel('IoU')
plt.grid(True)

# 显示图表
plt.tight_layout()
# plt.show()
plt.savefig('test.png')

# import matplotlib.pyplot as plt
#
# plt.rcParams["font.sans-serif"]=["SimHei"] #设置字体
#
# # 数据
#
# # 数据
# labels = [
#     'TestingSet 80', 'TestingSet 90',
#     'FCD 80', 'FCD 90',
#     'SCD 80', 'SCD 90'
# ]
# methods = ['PSCC-Net', 'BEIT', 'SwinTransformer', 'DocTamper', '本文方法']
# doc_tamper_testing_80 = [0.297, 0.407, 0.443, 0.772, 0.803]
# doc_tamper_testing_90 = [0.305, 0.451, 0.514, 0.793, 0.836]
# doc_tamper_fcd_80 = [0.304, 0.342, 0.337, 0.597, 0.638]
# doc_tamper_fcd_90 = [0.317, 0.373, 0.431, 0.604, 0.664]
# doc_tamper_scd_80 = [0.273, 0.301, 0.443, 0.526, 0.611]
# doc_tamper_scd_90 = [0.331, 0.409, 0.482, 0.599, 0.674]
#
# # 汇总数据
# data = [
#     doc_tamper_testing_80, doc_tamper_testing_90,
#     doc_tamper_fcd_80, doc_tamper_fcd_90,
#     doc_tamper_scd_80, doc_tamper_scd_90
# ]
#
# # 设置图形大小
# plt.figure(figsize=(14, 8))
#
# # 绘制折线图
# for i, method in enumerate(methods):
#     method_data = [data_set[i] for data_set in data]
#     plt.plot(labels, method_data, marker='o', linestyle='-', label=method)
#
# # 图例、标题和标签
# plt.legend()
# plt.title('不同方法在不同压缩比率下的检测交并比')
# plt.ylabel('IoU')
# plt.grid(True)
#
# # 显示图表
# plt.tight_layout()
# # plt.show()
# plt.savefig('test.png')
